import React from 'react'
import Loadable from "react-loadable"
//登陆页面
import Login from '../layout/login/login';
//404
import NoMatch404 from '../components/error/404';
import NoMatch403 from '../components/error/403';
import NoMatch500 from '../components/error/500';

//布局box
import Layout from '../layout/layout';
import Show from '../layout/content/index/Show';


//用户管理
import UserList from '../layout/content/user/user-list';
import UserRole from '../layout/content/user/user-role';

/**
 ** 示例
 **/
import Context from '../layout/content/example/context';
import Todo from '../layout/content/example/todo';

//示例 - async
const Dispatch1 = () => import('../layout/content/example/dispatch1');
const Dispatch2 = () => import('../layout/content/example/dispatch2');

const defaultLoad = () => <div/>;

let config = [
    {
        path: '/',
        exact: true,
        component: Layout
    },
    {
        path: '/login',
        component: Login
    },
    {
        path: '/app',
        component: Layout,
        routes: [
            {
                path: '/app/index',
                component: Context,
            },
            //订单
            {
                path: '/app/marketing/orderList',
                component:Todo
            },
            //工具
            {
                path: '/app/tool/upLoad',
                component: Loadable({
                    loader: Dispatch1,
                    loading: defaultLoad
                })
            },
            {
                path: '/app/tool/option2',
                component: Loadable({
                    loader: Dispatch2,
                    loading: defaultLoad
                })
            },
            //设置
            {
                path:'/app/option/user/userList',
                component:UserList
            },
            {
                path:'/app/option/user/userRole',
                component:UserRole
            },

            //error
            {
                path: '/app/404',
                component: NoMatch404
            },
            {
                path: '/app/403',
                component: NoMatch403
            },
            {
                path: '/app/500',
                component: NoMatch500
            },

        /**
         ** 示例路由部分
         **/
            {
                path: '/app/example/context',
                component: Context
            },
            {
                path: '/app/example/todo',
                component: Todo
            },
            {
                path: '/app/example/dispatch1',
                component: Loadable({
                    loader: Dispatch1,
                    loading: defaultLoad
                })
            },
            {
                path: '/app/example/dispatch2',
                component: Loadable({
                    loader: Dispatch2,
                    loading: defaultLoad
                })
            },
        ]
    }
];
export default config